Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Option::filter instead of open-coding it #80637

Merged
merged 1 commit into from
Jan 5, 2021
Merged

Conversation

LingMan
Copy link
Contributor

@LingMan LingMan commented Jan 3, 2021

@rustbot modify labels +C-cleanup +T-compiler

@rustbot rustbot added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 3, 2021
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 3, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_codegen_ssa v0.0.0 (/checkout/compiler/rustc_codegen_ssa)
error[E0308]: mismatched types
  --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:58:46
   |
57 | ...                   match (inner_ty.kind(), target_ty.kind()) {
   |                             ----------------------------------- this expression has type `(&rustc_middle::ty::TyKind<'_>, &rustc_middle::ty::TyKind<'_>)`
58 | ...                       (Infer(TyVar(&a_vid)), Infer(TyVar(&b_vid))) => self
   |                                        |
   |                                        |
   |                                        expected struct `TyVid`, found reference
   |                                        help: you can probably remove the explicit borrow: `a_vid`
   = note: expected struct `TyVid`
           found reference `&_`

error[E0308]: mismatched types
error[E0308]: mismatched types
  --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:58:68
   |
57 | ...                   match (inner_ty.kind(), target_ty.kind()) {
   |                             ----------------------------------- this expression has type `(&rustc_middle::ty::TyKind<'_>, &rustc_middle::ty::TyKind<'_>)`
58 | ...                       (Infer(TyVar(&a_vid)), Infer(TyVar(&b_vid))) => self
   |                                                              |
   |                                                              |
   |                                                              expected struct `TyVid`, found reference
   |                                                              help: you can probably remove the explicit borrow: `b_vid`
   = note: expected struct `TyVid`
           found reference `&_`

error: aborting due to 2 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rustc_infer`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--color" "always" "--features" " llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc-main" "-p" "rustc_codegen_ssa" "-p" "rustc_middle" "-p" "rustc_type_ir" "-p" "rustc_feature" "-p" "rustc_query_system" "-p" "rustc_arena" "-p" "rustc_index" "-p" "rustc_span" "-p" "rustc_session" "-p" "rustc_lint_defs" "-p" "rustc_incremental" "-p" "rustc_graphviz" "-p" "rustc_hir" "-p" "rustc_target" "-p" "rustc_macros" "-p" "rustc_errors" "-p" "rustc_attr" "-p" "rustc_lexer" "-p" "rustc_ast_pretty" "-p" "rustc_fs_util" "-p" "rustc_symbol_mangling" "-p" "rustc_apfloat" "-p" "rustc_data_structures" "-p" "rustc_serialize" "-p" "rustc_ast" "-p" "rustc_driver" "-p" "rustc_lint" "-p" "rustc_trait_selection" "-p" "rustc_infer" "-p" "rustc_parse_format" "-p" "rustc_parse" "-p" "rustc_mir" "-p" "coverage_test_macros" "-p" "rustc_metadata" "-p" "rustc_expand" "-p" "rustc_ast_passes" "-p" "rustc_error_codes" "-p" "rustc_save_analysis" "-p" "rustc_hir_pretty" "-p" "rustc_plugin_impl" "-p" "rustc_interface" "-p" "rustc_privacy" "-p" "rustc_codegen_llvm" "-p" "rustc_llvm" "-p" "rustc_resolve" "-p" "rustc_traits" "-p" "rustc_builtin_macros" "-p" "rustc_ast_lowering" "-p" "rustc_mir_build" "-p" "rustc_ty_utils" "-p" "rustc_passes" "-p" "rustc_typeck" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:02:32

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
..........................................................................................i......... 3800/11240
.................................................................................................... 3900/11240
.................................................................................................... 4000/11240
.................................................................................................... 4100/11240
.....................................ii...........F....F............................................ 4200/11240
..............FF.................................................................................... 4400/11240
.................................................i.................................................. 4500/11240
..................................F................................................................. 4600/11240
..........................................................................................F......... 4700/11240
..........................................................................................F......... 4700/11240
.................................................................................................... 4800/11240
..............................F..................................................................... 4900/11240
.......................................F.........................................................i.. 5000/11240
.................................................................................................... 5200/11240
.................................................................................................... 5300/11240
.................................................................................................... 5400/11240
.................................................................................................... 5500/11240
.................................................................................................... 5500/11240
.................................................................................................... 5600/11240
..................................................................i...........i..................... 5700/11240
.................................................................................................... 5800/11240
.................................................................................................... 5900/11240
........i........................................................................................... 6000/11240
....i.........................................F..............i..........................F........... 6100/11240
...................................................................ii..ii......i...i................ 6200/11240
.......................i.........................i.................................................. 6400/11240
..........................................................i......................................... 6500/11240
.................................................................................................... 6600/11240
...............................ii..........................................i........................ 6700/11240
---
.................................................................................................... 9000/11240
.................................................................................................... 9100/11240
.................................................................................................... 9200/11240
....................................i......i........................................................ 9300/11240
...........................................................................iiiiii..iiiiii.i......... 9400/11240
.................................................................................................... 9600/11240
.................................................................................................... 9700/11240
.................................................................................................... 9800/11240
.................................................................................................... 9900/11240
.................................................................................................... 9900/11240
..........................................................................F......................... 10000/11240
..............................................F.FF.................................................. 10100/11240
.................................................................F.................................. 10300/11240
.................................................................................................... 10400/11240
.................................................................................................... 10500/11240
.................................................................................................i.. 10600/11240
.................................................................................................i.. 10600/11240
..........................................................................FF.F...................... 10700/11240
..................................................................F................................. 10800/11240
.................................................................................................... 11000/11240
.................................................................................................... 11100/11240
...............................i.................................................................... 11200/11240
........................................
........................................
failures:

---- [ui] ui/array-slice-vec/vector-no-ann.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `Vec<T>`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let _foo = Vec::new();

5    |         ----   ^^^^^^^^ cannot infer type for type parameter `T`
6    |         |
-    |         consider giving `_foo` the explicit type `Vec<T>`, where the type parameter `T` is specified
+    |         consider giving `_foo` a type
9 error: aborting due to previous error
10 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/array-slice-vec/vector-no-ann/vector-no-ann.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args array-slice-vec/vector-no-ann.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/array-slice-vec/vector-no-ann.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/array-slice-vec/vector-no-ann" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/array-slice-vec/vector-no-ann/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/array-slice-vec/vector-no-ann.rs:2:16
   |
LL |     let _foo = Vec::new();
   |         ----   ^^^^^^^^ cannot infer type for type parameter `T`
   |         |
   |         consider giving `_foo` a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.

---

7    = note: `#[warn(incomplete_features)]` on by default
8    = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
9 
- error[E0282]: type annotations needed for `impl Future`
+ error[E0282]: type annotations needed
12    |
12    |
13 LL |     let fut = async {

-    |         --- consider giving `fut` the explicit type `impl Future`, with the type parameters specified
+    |         --- consider giving `fut` a type
15 LL |         make_unit()?;
16    |                    ^ cannot infer type


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings/cannot-infer-async-enabled-impl-trait-bindings.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings/cannot-infer-async-enabled-impl-trait-bindings.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args inference/cannot-infer-async-enabled-impl-trait-bindings.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
   |
LL | #![feature(impl_trait_in_bindings)]
   |            ^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = note: `#[warn(incomplete_features)]` on by default
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information

error[E0282]: type annotations needed
  --> /checkout/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs:13:20
   |
LL |     let fut = async {
   |         --- consider giving `fut` a type
LL |         make_unit()?; //~ ERROR type annotations needed
   |                    ^ cannot infer type
error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/inference/cannot-infer-closure.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for the closure `fn((), ()) -> std::result::Result<(), _>`
+ error[E0282]: type annotations needed
3    |
3    |
+ LL |     let x = |a: (), b: ()| {
+    |         - consider giving `x` a type
4 LL |         Err(a)?;
5    |               ^ cannot infer type
-    |
- help: give this closure an explicit return type without `_` placeholders
-    |
- LL |     let x = |a: (), b: ()| -> std::result::Result<(), _> {
11 
12 error: aborting due to previous error
13 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/inference/cannot-infer-closure/cannot-infer-closure.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args inference/cannot-infer-closure.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/inference/cannot-infer-closure.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/inference/cannot-infer-closure" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/inference/cannot-infer-closure/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/inference/cannot-infer-closure.rs:3:15
   |
LL |     let x = |a: (), b: ()| {
   |         - consider giving `x` a type
LL |         Err(a)?; //~ ERROR type annotations needed for the closure
   |               ^ cannot infer type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/issues/issue-12187-1.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `&T`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let &v = new();
5    |         -^
6    |         ||
7    |         |cannot infer type
7    |         |cannot infer type
-    |         consider giving this pattern the explicit type `&T`, with the type parameters specified
+    |         consider giving this pattern a type
10 error: aborting due to previous error
11 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-12187-1/issue-12187-1.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-12187-1.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-12187-1.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-12187-1" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-12187-1/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-12187-1.rs:6:10
   |
LL |     let &v = new();
   |         -^
   |         ||
   |         |cannot infer type
   |         consider giving this pattern a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/issues/issue-12187-2.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `&T`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let &v = new();
5    |         -^
6    |         ||
7    |         |cannot infer type
7    |         |cannot infer type
-    |         consider giving this pattern the explicit type `&T`, with the type parameters specified
+    |         consider giving this pattern a type
10 error: aborting due to previous error
11 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-12187-2/issue-12187-2.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-12187-2.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-12187-2.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-12187-2" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-12187-2/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-12187-2.rs:6:10
   |
LL |     let &v = new();
   |         -^
   |         ||
   |         |cannot infer type
   |         consider giving this pattern a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/issues/issue-17551.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `B<T>`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let foo = B(marker::PhantomData);

5    |         ---   ^ cannot infer type for type parameter `T` declared on the struct `B`
6    |         |
-    |         consider giving `foo` the explicit type `B<T>`, where the type parameter `T` is specified
+    |         consider giving `foo` a type
9 error: aborting due to previous error
10 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-17551/issue-17551.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-17551.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-17551.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-17551" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-17551/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-17551.rs:6:15
   |
LL |     let foo = B(marker::PhantomData); //~ ERROR type annotations needed
   |         ---   ^ cannot infer type for type parameter `T` declared on the struct `B`
   |         |
   |         consider giving `foo` a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/issues/issue-20261.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `&(_,)`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     for (ref i,) in [].iter() {

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-20261/issue-20261.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-20261/issue-20261.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-20261.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-20261.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-20261" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-20261/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-20261.rs:4:11
   |
LL |     for (ref i,) in [].iter() {
   |                     --------- the element type for this iterator is not specified
LL |         i.clone();
   |           ^^^^^ cannot infer type
   |
   = note: type must be known at this point
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/issues/issue-23046.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `Expr<'_, VAR>`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let ex = |x| {

-    |               ^ consider giving this closure parameter the explicit type `Expr<'_, VAR>`, where the type parameter `VAR` is specified
+    |               ^ consider giving this closure parameter a type
7 error: aborting due to previous error
8 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-23046/issue-23046.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-23046.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-23046.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-23046" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-23046/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-23046.rs:17:15
   |
LL |     let ex = |x| { //~ ERROR type annotations needed
   |               ^ consider giving this closure parameter a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/issues/issue-25368.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `(Sender<Foo<T>>, std::sync::mpsc::Receiver<Foo<T>>)`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let (tx, rx) = channel();

-    |         -------- consider giving this pattern the explicit type `(Sender<Foo<T>>, std::sync::mpsc::Receiver<Foo<T>>)`, where the type parameter `T` is specified
+    |         -------- consider giving this pattern a type
6 ...
7 LL |         tx.send(Foo{ foo: PhantomData });
8    |                 ^^^ cannot infer type for type parameter `T` declared on the struct `Foo`

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-25368/issue-25368.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-25368/issue-25368.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-25368.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-25368.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-25368" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-25368/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-25368.rs:11:17
   |
LL |     let (tx, rx) = channel();
   |         -------- consider giving this pattern a type
...
LL |         tx.send(Foo{ foo: PhantomData }); //~ ERROR E0282
   |                 ^^^ cannot infer type for type parameter `T` declared on the struct `Foo`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/issues/issue-72690.rs stdout ----
diff of stderr:

13 LL |     |x| String::from("x".as_ref());
14    |      ^ consider giving this closure parameter a type
15 
- error[E0283]: type annotations needed for `&T`
+ error[E0283]: type annotations needed
18    |
18    |
19 LL |     let _ = "x".as_ref();

20    |         -       ^^^^^^ cannot infer type for type parameter `T` declared on the trait `AsRef`
21    |         |
-    |         consider giving this pattern the explicit type `&T`, where the type parameter `T` is specified
+    |         consider giving this pattern a type
23    |
24    = note: cannot satisfy `str: AsRef<_>`


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-72690/issue-72690.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-72690/issue-72690.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-72690.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-72690.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-72690" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-72690/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:7:5
   |
LL |     String::from("x".as_ref()); //~ ERROR type annotations needed
   |     ^^^^^^^^^^^^ cannot infer type for reference `&_`
   |
   = note: cannot satisfy `String: From<&_>`
   = note: required by `from`
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:11:6
   |
   |
LL |     |x| String::from("x".as_ref()); //~ ERROR type annotations needed
   |      ^ consider giving this closure parameter a type
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:15:17
   |
   |
LL |     let _ = "x".as_ref(); //~ ERROR type annotations needed
   |         -       ^^^^^^ cannot infer type for type parameter `T` declared on the trait `AsRef`
   |         |
   |         consider giving this pattern a type
   |
   = note: cannot satisfy `str: AsRef<_>`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:19:5
   |
   |
LL |     String::from("x".as_ref()); //~ ERROR type annotations needed
   |     ^^^^^^^^^^^^ cannot infer type for reference `&_`
   |
   = note: cannot satisfy `String: From<&_>`
   = note: required by `from`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:25:5
   |
   |
LL |     String::from("x".as_ref()); //~ ERROR type annotations needed
   |     ^^^^^^^^^^^^ cannot infer type for reference `&_`
   |
   = note: cannot satisfy `String: From<&_>`
   = note: required by `from`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:33:5
   |
   |
LL |     String::from("x".as_ref()); //~ ERROR type annotations needed
   |     ^^^^^^^^^^^^ cannot infer type for reference `&_`
   |
   = note: cannot satisfy `String: From<&_>`
   = note: required by `from`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:41:5
   |
   |
LL |     String::from("x".as_ref()); //~ ERROR type annotations needed
   |     ^^^^^^^^^^^^ cannot infer type for reference `&_`
   |
   = note: cannot satisfy `String: From<&_>`
   = note: required by `from`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:47:5
   |
   |
LL |     String::from("x".as_ref()); //~ ERROR type annotations needed
   |     ^^^^^^^^^^^^ cannot infer type for reference `&_`
   |
   = note: cannot satisfy `String: From<&_>`
   = note: required by `from`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/issues/issue-72690.rs:55:5
   |
   |
LL |     String::from("x".as_ref()); //~ ERROR type annotations needed
   |     ^^^^^^^^^^^^ cannot infer type for reference `&_`
   |
   = note: cannot satisfy `String: From<&_>`
   = note: required by `from`
error: aborting due to 9 previous errors

Some errors have detailed explanations: E0282, E0283.
For more information about an error, try `rustc --explain E0282`.
For more information about an error, try `rustc --explain E0282`.

------------------------------------------
---

---- [ui] ui/suggestions/fn-needing-specified-return-type-param.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `fn() -> A`
+ error[E0282]: type annotations needed
2   --> $DIR/fn-needing-specified-return-type-param.rs:3:13
3    |
4 LL |     let _ = f;

5    |         -   ^ cannot infer type for type parameter `A` declared on the function `f`
6    |         |
-    |         consider giving this pattern the explicit type `fn() -> A`, where the type parameter `A` is specified
+    |         consider giving this pattern a type
9 error: aborting due to previous error
10 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/fn-needing-specified-return-type-param/fn-needing-specified-return-type-param.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args suggestions/fn-needing-specified-return-type-param.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/fn-needing-specified-return-type-param" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/fn-needing-specified-return-type-param/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs:3:13
   |
LL |     let _ = f; //~ ERROR type annotations needed for `fn() -> A`
   |         -   ^ cannot infer type for type parameter `A` declared on the function `f`
   |         |
   |         consider giving this pattern a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/suggestions/suggest-closure-return-type-1.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for the closure `fn() -> [_; 0]`
+ error[E0282]: type annotations needed
2   --> $DIR/suggest-closure-return-type-1.rs:2:24
3    |
4 LL |     let _v = || -> _ { [] };
-    |                        ^^ cannot infer type
-    |
-    |
- help: give this closure an explicit return type without `_` placeholders
-    |
- LL |     let _v = || -> [_; 0] { [] };
+    |         --             ^^ cannot infer type
+    |         |
+    |         |
+    |         consider giving `_v` a type
12 error: aborting due to previous error
13 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-1/suggest-closure-return-type-1.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args suggestions/suggest-closure-return-type-1.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/suggest-closure-return-type-1.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-1" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-1/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/suggestions/suggest-closure-return-type-1.rs:2:24
   |
LL |     let _v = || -> _ { [] }; //~ ERROR type annotations needed for the closure
   |         --             ^^ cannot infer type
   |         |
   |         consider giving `_v` a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/suggestions/suggest-closure-return-type-2.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for the closure `fn() -> [_; 0]`
+ error[E0282]: type annotations needed
2   --> $DIR/suggest-closure-return-type-2.rs:2:19
3    |
4 LL |     let _v = || { [] };
-    |                   ^^ cannot infer type
-    |
-    |
- help: give this closure an explicit return type without `_` placeholders
-    |
- LL |     let _v = || -> [_; 0] { [] };
+    |         --        ^^ cannot infer type
+    |         |
+    |         |
+    |         consider giving `_v` a type
12 error: aborting due to previous error
13 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-2/suggest-closure-return-type-2.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args suggestions/suggest-closure-return-type-2.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/suggest-closure-return-type-2.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-2" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-2/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/suggestions/suggest-closure-return-type-2.rs:2:19
   |
LL |     let _v = || { [] }; //~ ERROR type annotations needed for the closure
   |         --        ^^ cannot infer type
   |         |
   |         consider giving `_v` a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/suggestions/suggest-closure-return-type-3.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for the closure `fn() -> [_; 0]`
+ error[E0282]: type annotations needed
2   --> $DIR/suggest-closure-return-type-3.rs:2:17
3    |
4 LL |     let _v = || [];
-    |                 ^^ cannot infer type
-    |
-    |
- help: give this closure an explicit return type without `_` placeholders
-    |
- LL |     let _v = || -> [_; 0] { [] };
-    |                 ^^^^^^^^^^^    ^
+    |         --      ^^ cannot infer type
+    |         |
+    |         consider giving `_v` a type
12 error: aborting due to previous error
13 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-3/suggest-closure-return-type-3.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args suggestions/suggest-closure-return-type-3.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/suggest-closure-return-type-3.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-3" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-closure-return-type-3/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/suggestions/suggest-closure-return-type-3.rs:2:17
   |
LL |     let _v = || []; //~ ERROR type annotations needed for the closure
   |         --      ^^ cannot infer type
   |         |
   |         consider giving `_v` a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/traits/issue-77982.rs stdout ----
diff of stderr:

19    = note: cannot satisfy `u32: From<_>`
20    = note: required by `from`
21 
- error[E0283]: type annotations needed for `Box<T>`
+ error[E0283]: type annotations needed
24    |
24    |
25 LL |     let _ = ().foo();

26    |         -      ^^^ cannot infer type for type parameter `T` declared on the trait `Foo`
27    |         |
-    |         consider giving this pattern the explicit type `Box<T>`, where the type parameter `T` is specified
+    |         consider giving this pattern a type
29    |
30    = note: cannot satisfy `(): Foo<'_, _>`


- error[E0283]: type annotations needed for `Box<T>`
+ error[E0283]: type annotations needed
34    |
34    |
35 LL |     let _ = (&()).bar();

36    |         -         ^^^ cannot infer type for type parameter `T` declared on the trait `Bar`
37    |         |
-    |         consider giving this pattern the explicit type `Box<T>`, where the type parameter `T` is specified
+    |         consider giving this pattern a type
39    |
40    = note: cannot satisfy `&(): Bar<'_, _>`


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-77982/issue-77982.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-77982/issue-77982.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args traits/issue-77982.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/issue-77982.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-77982" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-77982/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/traits/issue-77982.rs:8:10
   |
LL |     opts.get(opt.as_ref()); //~ ERROR type annotations needed
   |          ^^^ ------------ this method call resolves to `&T`
   |          |
   |          cannot infer type for type parameter `Q` declared on the associated function `get`
   |
   = note: cannot satisfy `String: Borrow<_>`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/traits/issue-77982.rs:12:44
   |
   |
LL |     let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
   |                                            ^^^^^^^^^ ----------- this method call resolves to `T`
   |                                            |
   |                                            cannot infer type for type parameter `T` declared on the trait `From`
   |
   = note: cannot satisfy `u32: From<_>`
   = note: required by `from`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/traits/issue-77982.rs:35:16
   |
   |
LL |     let _ = ().foo(); //~ ERROR type annotations needed
   |         -      ^^^ cannot infer type for type parameter `T` declared on the trait `Foo`
   |         |
   |         consider giving this pattern a type
   |
   = note: cannot satisfy `(): Foo<'_, _>`
error[E0283]: type annotations needed
  --> /checkout/src/test/ui/traits/issue-77982.rs:39:19
   |
   |
LL |     let _ = (&()).bar(); //~ ERROR type annotations needed
   |         -         ^^^ cannot infer type for type parameter `T` declared on the trait `Bar`
   |         |
   |         consider giving this pattern a type
   |
   = note: cannot satisfy `&(): Bar<'_, _>`
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0283`.


------------------------------------------


---- [ui] ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `(Vec<T>,)`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let (x, ) = (vec![], );

5    |         -----    ^^^^^^ cannot infer type for type parameter `T`
6    |         |
-    |         consider giving this pattern the explicit type `(Vec<T>,)`, where the type parameter `T` is specified
+    |         consider giving this pattern a type
9    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
10 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples/cannot_infer_local_or_vec_in_tuples.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type/type-check/cannot_infer_local_or_vec_in_tuples.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs:2:18
   |
LL |     let (x, ) = (vec![], );
   |         -----    ^^^^^^ cannot infer type for type parameter `T`
   |         |
   |         consider giving this pattern a type
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

---

---- [ui] ui/type/type-check/cannot_infer_local_or_vec.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `Vec<T>`
+ error[E0282]: type annotations needed
3    |
3    |
4 LL |     let x = vec![];

5    |         -   ^^^^^^ cannot infer type for type parameter `T`
6    |         |
-    |         consider giving `x` the explicit type `Vec<T>`, where the type parameter `T` is specified
+    |         consider giving `x` a type
9    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
10 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_vec/cannot_infer_local_or_vec.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type/type-check/cannot_infer_local_or_vec.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_vec" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_vec/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs:2:13
   |
LL |     let x = vec![];
   |         -   ^^^^^^ cannot infer type for type parameter `T`
   |         |
   |         consider giving `x` a type
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

---

---- [ui] ui/type/type-check/cannot_infer_local_or_array.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `[_; 0]`
+ error[E0282]: type annotations needed
3    |
4 LL |     let x = [];


5    |         -   ^^ cannot infer type
6    |         |
-    |         consider giving `x` the explicit type `[_; 0]`, with the type parameters specified
+    |         consider giving `x` a type
9 error: aborting due to previous error
10 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_array/cannot_infer_local_or_array.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type/type-check/cannot_infer_local_or_array.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type/type-check/cannot_infer_local_or_array.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_array" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-check/cannot_infer_local_or_array/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/type/type-check/cannot_infer_local_or_array.rs:2:13
   |
LL |     let x = []; //~ ERROR type annotations needed
   |         -   ^^ cannot infer type
   |         |
   |         consider giving `x` a type
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.


------------------------------------------


---- [ui] ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs stdout ----
diff of stderr:

- error[E0282]: type annotations needed for `Option<T>`
+ error[E0282]: type annotations needed
3    |
4 LL |     let mut closure0 = None;


-    |         ------------ consider giving `closure0` the explicit type `Option<T>`, with the type parameters specified
+    |         ------------ consider giving `closure0` a type
7 LL |                         return c();
8    |                                ^^^ cannot infer type



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2/unboxed-closures-failed-recursive-fn-2.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0282]: type annotations needed
  --> /checkout/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs:16:32
   |
LL |     let mut closure0 = None;
   |         ------------ consider giving `closure0` a type
LL |                         return c();
   |                                ^^^ cannot infer type
   |
   |
   = note: type must be known at this point
error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.

---

Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:15:51

@LingMan
Copy link
Contributor Author

LingMan commented Jan 3, 2021

Turned the call to resolve_vars_if_possible from a let binding into a call to Option::map. That should fix the test failures. Turns out the shadowing of ty also changed the returned value, not just the if evaluation.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 4, 2021

Not sure if this is better or worse, but the first two method calls made me reach for the ? operator, and I ended up with

let typeck_results = self.infcx.in_progress_typeck_results?;
let ty = typeck_results.borrow().node_type_opt(hir_id)?;
let ty = self.infcx.resolve_vars_if_possible(ty);
for inner in ty.walk() {
    if inner == self.target {
        return Some(ty);
    }
    if let GenericArgKind::Type(inner_ty) = inner.unpack() {
        if let ty::Infer(ty::TyVar(a_vid)) = inner_ty.kind() {
            if let GenericArgKind::Type(target_ty) = self.target.unpack() {
                if let ty::Infer(ty::TyVar(b_vid)) = target_ty.kind() {
                    if self.infcx.inner.borrow_mut().type_variables().sub_unified(a_vid, b_vid) {
                        return Some(ty);
                    }
                }
            }
        }
    }
}
None

a bit much nesting, but there are no helper methods returning options that could be used here. Maybe we need to add them? Anyway, the diff lgtm as it is, so let me know if you want to merge it or iterate some more.

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned estebank Jan 4, 2021
@jyn514
Copy link
Member

jyn514 commented Jan 4, 2021

This looks like a good candidate for if_chain.

@LingMan
Copy link
Contributor Author

LingMan commented Jan 4, 2021

Personally I'm a fan of method chaining and would like to keep that intact. Those matches are indeed a bit gnarly, but so is that if let ladder if you ask me.

Some helper to do if let in a method chaining way would be great. This isn't the first instance where that would be helpful.
Then one could do something like:

    fn node_ty_contains_target(&mut self, hir_id: HirId) -> Option<Ty<'tcx>> {
        self.infcx
            .in_progress_typeck_results
            .and_then(|typeck_results| typeck_results.borrow().node_type_opt(hir_id))
            .map(|ty| self.infcx.resolve_vars_if_possible(ty))
            .filter(|ty| {
                ty.walk().any(|inner| {
                    if inner == self.target {
                        return true;
                    }

                    let avid = Some(inner)
                        .if_let(GenericArgKind::Type(inner_ty), |inner| inner.unpack())
                        .if_let(ty::Infer(ty::TyVar(a_vid)), |inner_ty| inner_ty.kind());
                    let bvid = Some(self.target)
                        .if_let(GenericArgKind::Type(target_ty), |target| target.unpack())
                        .if_let(ty::Infer(ty::TyVar(b_vid)), |target_ty| target_ty.kind());

                    avid.zip(bvid).map_or(false, |(avid, bvid)| {
                        self.infcx.inner.borrow_mut().type_variables().sub_unified(a_vid, b_vid)
                    })
                })
            })
    }

For now I'd like to merge this as is, but it's certainly a spot for a followup if/when a fitting helper becomes available.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 4, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 4, 2021

📌 Commit 203d502 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 4, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 5, 2021
Rollup of 12 pull requests

Successful merges:

 - rust-lang#80442 (Mention Arc::make_mut and Rc::make_mut in the documentation of Cow)
 - rust-lang#80533 (bootstrap: clippy fixes)
 - rust-lang#80538 (Add check for `[T;N]`/`usize` mismatch in astconv)
 - rust-lang#80612 (Remove reverted change from relnotes)
 - rust-lang#80627 (Builder: Warn if test file does not exist)
 - rust-lang#80637 (Use Option::filter instead of open-coding it)
 - rust-lang#80643 (Move variable into the only branch where it is relevant)
 - rust-lang#80656 (Fixed documentation error for `std::hint::spin_loop`)
 - rust-lang#80666 (Fix missing link for "fully qualified syntax")
 - rust-lang#80672 (./x.py clippy: allow the most noisy lints)
 - rust-lang#80677 (doc -- list edit for consistency)
 - rust-lang#80696 (make sure that promoteds which fail to evaluate in dead const code behave correctly)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit faf8bed into rust-lang:master Jan 5, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 5, 2021
@LingMan LingMan deleted the filter branch January 5, 2021 06:39
rylev added a commit to rylev/rust that referenced this pull request Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants